public class Sort {
    public void quickSort(int[] array) {
        int len = array.length - 1;
        quick(array,0,len);
    }
    private void quick(int[] array,int start,int end) {
        if(start >= end) {
            return;
        }
        int cmd = sort(array,start,end);
        quick(array,cmd+1,end);
        quick(array,start,cmd - 1);
    }
    private int sort(int[] array,int left,int right) {
        int tmp = array[left];
        while(left < right) {
            while(array[right] >= tmp && left < right) {
                right--;
            }
            array[left] = array[right];
            while(array[left] <= tmp && left < right) {
                left++;
            }
            array[right] = array[left];
        }
        array[left] = tmp;
        return left;
    }
}
